import fetch from 'common/src/utils/fetch';
import baseUrl from './env';
import UTILS from "common/src/utils/utils";
import {
  param
} from 'common/src/utils';
import axios from 'axios';
const BASER_SERV_URL = '/api/baseresservice';


// 统计分析列表
function listAnalysis(data) {
  return fetch({
    url: `${baseUrl}/pgStatisticsAnalysis/listAnalysis`,
    method: 'Post',
    data
  });
}

// 修改每年实际的外方留学生名额
function editRealOutlandNumber(data) {
  return fetch({
    url: `${baseUrl}/pgStatisticsAnalysis/editRealOutlandNumber`,
    method: 'Post',
    data
  });
}

// 导出统计分析列表
function exportList(data) {
  return fetch({
    url: `${baseUrl}/pgStatisticsAnalysis/exportList`,
    method: 'Post',
    data
  });
}

// 导出2
function exportExcelS(data) {
  return fetch({
    url: `${baseUrl}/export/result/` + data,
    method: 'get',
    data
  })
}

// 导出3
function exportExcelT(data) {
  return fetch({
    url: `${baseUrl}/export/file/?path=` + data,
    method: 'get',
    data,
    responseType: 'blob'
  }).then(res => {
    UTILS.downloadFile(res, '校际交流导出.xls', 'application/vnd.ms-excel;charset=utf-8');

  });
}

// 学位获得时间列表
function listDegree(data) {
  return fetch({
    url: `${baseUrl}/interschoolStudentApply/listDegree`,
    method: 'Post',
    data
  });
}

// 学位获得时间导出
function exportDegree(data) {
  return fetch({
    url: `${baseUrl}/interschoolStudentApply/exportDegree`,
    method: 'Post',
    data
  });
}

// 文件下载
function downFile(data) {
  return fetch({
    url: `${baseUrl}/sysDictionary/downFile?path=` + data,
    method: 'get'

  });
}

// 学生学位获得时间
function saveDegree(data) {
  return fetch({
    url: `${baseUrl}/interschoolStudentApply/saveDegree`,
    method: 'Post',
    data
  });
}

//查询国家地区
export function getALLCollege(data) {
  return fetch({
      url: `api/commonservice/dictionary/getDictList/page/1/1000`,
      method: 'post',
      data: { "relateType": "4", "type": "G_GJQU", "remark": "国家" }
  })
}

export default {
  'listAnalysis': listAnalysis,
  'editRealOutlandNumber': editRealOutlandNumber,
  'exportList': exportList,
  'exportExcelS': exportExcelS,
  'exportExcelT': exportExcelT,
  'listDegree': listDegree,
  'exportDegree': exportDegree,
  'downFile': downFile,
  'saveDegree': saveDegree,
  'getALLCollege': getALLCollege

};
